﻿<%@ WebHandler Language="C#" Class="Product_UpdateStatus" %>

using System;
using System.Web;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

public class Product_UpdateStatus : IHttpHandler
{
    
    TblSanPhamManager _TblSanPhamManager = new TblSanPhamManager();
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/html";
        string check = "";
        int NewsID = 0;
        try{NewsID = Convert.ToInt32(context.Request.QueryString["id"].Trim());}
        catch{NewsID = 0;}

        if (NewsID != 0)
        {
            TblSanPhamEntity _TblSanPhamEntity = _TblSanPhamManager.SelectOne(NewsID);
            _TblSanPhamEntity.TrangThai = !_TblSanPhamEntity.TrangThai;
            check = _TblSanPhamEntity.TrangThai.ToString();

            try { _TblSanPhamManager.Update(_TblSanPhamEntity).ToString(); check = _TblSanPhamEntity.TrangThai.ToString().ToLower(); }
            catch { }
        }
        context.Response.Write(check);
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}